package com.example.combwyaq.visualinterface.people.entity;

import com.example.combwyaq.mvp.model.entity.BaseEntity;
import com.example.combwyaq.utils.LogUtils;
import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

public class RecommendEntity extends BaseEntity {
    public String values;

    public List<Values>getValues(){
        if (values == null)
            return null;
        List<Values> list = new ArrayList<>();
        try {
            JSONArray jay = new JSONArray(values);
            for (int i = 0;i < jay.length();i ++){
                String str = jay.getString(i);
                LogUtils.e("RecommendEntity:values:"+str);
                Values values = new Gson().fromJson(str,Values.class);
                list.add(values);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return list;
    }

    public static class Values{
        public int news_type;
        public String news_author;
        public String news_value;
        public String news_title;
        public String news_url;
        public long news_time;
        public long author_id;
        public long channel_id;
        public long news_id;
        public List<MediaValues> medias;

        public List<MediaValues>getMedias(){

            return medias;
        }

    }

    public static class MediaValues{
        public int media_type;
        public long media_id;
        public String media_url;
    }

}
